package com.scatteredServer.controller;

import com.scatteredServer.client.PerformanceClient;
import com.scatteredServer.client.TeacherStatsClient;
import com.scatteredServer.common.Result;
import com.scatteredServer.mapper.PostingMapper;
import com.scatteredServer.pojo.vo.JobStatusVo;
import com.scatteredServer.pojo.vo.PostingStatusVo;
import com.scatteredServer.pojo.vo.ServiceCountVo;
import com.scatteredServer.service.impl.PostingServiceImpl;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * todo
 * 数据统计接口
 *
 * */
@RestController
@RequestMapping("s4/countData")
@Slf4j
@Tag(name = "信息统计", description = "信息统计")
public class CountDataController {
    @Autowired
    TeacherStatsClient teacherStatsClient;

    @Autowired
    PostingServiceImpl postingService;

    @Autowired
    PerformanceClient performanceClient;

    @Operation(summary = "教师相关信息统计", description = "教师相关信息统计")
    @GetMapping("/teacherStats")
    public Result<List<Map<String,Object>>> teacherStats(@RequestParam("typename") String typename) {
        return teacherStatsClient.teacherStats(typename);
    }

    @Operation(summary = "发文信息统计", description = "发文信息统计")
    @GetMapping("/postingStatus")
    public Result<PostingStatusVo> postingStatus() {
        return postingService.postingStatus();
    }

    @Operation(summary = "动态业绩表单统计", description = "动态业绩表单统计")
    @GetMapping("/performance")
    public Result performance() {
        return performanceClient.getPerformanceCount();
    }

    @Operation(summary = "岗位聘任统计", description = "岗位聘任统计")
    @GetMapping("/jobCount")
    public Result<JobStatusVo> jobCount() {
        return postingService.jobCount();
    }

    @Operation(summary = "公共服务统计", description = "公共服务统计")
    @GetMapping("/serviceCount")
    public Result<List<ServiceCountVo>> serviceCount(@RequestParam("year") String year) {
        return postingService.serviceCount(year);
    }

}
